import time

def bubble(m):
    ended = True
    while ended:
        ended = False
        for i in range(1, len(m)):
            if m[i] < m[i-1]:
                m[i], m[i-1] = m[i-1], m[i]
                ended = True

with open('m1_sorted.txt') as f:
    m1 = list(map(int, f.readlines()))
    t1 = time.time()
    bubble(m1)
    t2 = time.time()
    print(f'm1 - {t2 - t1}')

with open('m2_reverse.txt') as f:
    m2 = list(map(int, f.readlines()))
    t3 = time.time()
    bubble(m2)
    t4 = time.time()
    print(f'm2 - {t4 - t3}')

with open('m3_shuffle.txt') as f:
    m3 = list(map(int, f.readlines()))
    t5 = time.time()
    bubble(m3)
    t6 = time.time()
    print(f'm3 - {t6 - t5}')
    
    
    
